﻿using University.Workshop.Presenters;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;

namespace University.Workshop.Tests
{
    [TestClass()]
    public class RegistrationRentPresenterTest
    {


        private TestContext testContextInstance;

        public TestContext TestContext
        {
            get
            {
                return testContextInstance;
            }
            set
            {
                testContextInstance = value;
            }
        }

        #region Additional test attributes
        // 
        //You can use the following additional attributes as you write your tests:
        //
        //Use ClassInitialize to run code before running the first test in the class
        //[ClassInitialize()]
        //public static void MyClassInitialize(TestContext testContext)
        //{
        //}
        //
        //Use ClassCleanup to run code after all tests in a class have run
        //[ClassCleanup()]
        //public static void MyClassCleanup()
        //{
        //}
        //
        //Use TestInitialize to run code before running each test
        //[TestInitialize()]
        //public void MyTestInitialize()
        //{
        //}
        //
        //Use TestCleanup to run code after each test has run
        //[TestCleanup()]
        //public void MyTestCleanup()
        //{
        //}
        //
        #endregion


        [TestMethod()]
        public void OnAddAnAmountToListTest()
        {
            RentMock view = new RentMock();
            RegistrationRentPresenter target = new RegistrationRentPresenter(view);
            view.AddAnAmountToListGood();
            string expected = "Todo esta bien"; 
            string actual;
            actual = target.OnAddAnAmountToList();
            Assert.AreEqual(expected, actual);
        }

        [TestMethod()]
        public void OnAddAnAmountToListTestFailAmount()
        {
            RentMock view = new RentMock();
            RegistrationRentPresenter target = new RegistrationRentPresenter(view);
            view.AddAnAmountToListWithOutAnAmount();
            string expected = "Ingrese un monto...";
            string actual;
            actual = target.OnAddAnAmountToList();
            Assert.AreEqual(expected, actual);
        }

        [TestMethod()]
        public void OnAddAnAmountToListTestFailNote()
        {
            RentMock view = new RentMock();
            RegistrationRentPresenter target = new RegistrationRentPresenter(view);
            view.AddAnAmountToListWithOutANote();
            string expected = "Ingrese una nota del monto...";
            string actual;
            actual = target.OnAddAnAmountToList();
            Assert.AreEqual(expected, actual);
        }

        [TestMethod()]
        public void OnInitializeFormGetRentCodeTest()
        {
            RentMock view = new RentMock();
            RegistrationRentPresenter target = new RegistrationRentPresenter(view);
            view.GetRentCode();
            bool expected = true;
            bool actual;
            actual = target.OnInitializeFormGetRentCode();
            Assert.AreEqual(expected, actual);
        }

        [TestMethod()]
        public void OnRegisterARentTest()
        {
            RentMock view = new RentMock();
            RegistrationRentPresenter target = new RegistrationRentPresenter(view);
            view.RegisterRent();
            string expected = "Registro exitoso!"; 
            string actual;
            actual = target.OnRegisterRent();
            Assert.AreEqual(expected, actual);
        }

        [TestMethod()]
        public void OnRegisterARentTestFailNotEnterConcept()
        {
            RentMock view = new RentMock();
            RegistrationRentPresenter target = new RegistrationRentPresenter(view);
            view.RegisterRentFailConcept();
            string expected = "Falta llenar campos obligatorios!";
            string actual;
            actual = target.OnRegisterRent();
            Assert.AreEqual(expected, actual);
        }

        [TestMethod()]
        public void OnRegisterARentTestFailNotEnterAmounts()
        {
            RentMock view = new RentMock();
            RegistrationRentPresenter target = new RegistrationRentPresenter(view);
            view.RegisterRentFailAmounts();
            string expected = "No hay ningun producto en la lista de venta!";
            string actual;
            actual = target.OnRegisterRent();
            Assert.AreEqual(expected, actual);
        }
    }
}
